var a = getApp();

Page({
    data: {
        active: 0
    },
    onLoad: function(a) {
        this.getdata();
    },
    handleClick: function(a) {
        this.setData({
            active: a.detail.index
        }), this.getdata();
    },
    getdata: function() {
        var t = this, e = a.getNetAddresss("plugin.snatch-regiment.api.index.getSnatchData");
        a._getNetWork({
            url: e,
            data: {
                art: "leagueReward",
                prize: 0 == t.data.active ? 1 : 0
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? t.setData({
                    isLoadMore: !0,
                    page: 1,
                    total_page: e.data.leagueReward.last_page,
                    dataList: e.data.leagueReward.data
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    _getMoreData: function() {
        var t = this, e = {}, o = "", n = "";
        t.data.isLoadMore = !1, this.data.page >= this.data.total_page || (this.data.page = this.data.page + 1, 
        o = "plugin.snatch-regiment.api.index.getSnatchData", e = {
            page: t.data.page,
            art: "leagueReward",
            prize: 0 == t.data.active ? 1 : 0
        }, n = a.getNetAddresss(o), a._postNetWork({
            url: n,
            showToastIn: !1,
            data: e,
            success: function(a) {
                var e = a.data;
                1 == e.result ? t.setData({
                    isLoadMore: !0,
                    dataList: t.data.dataList.concat(e.data.leagueReward.data)
                }) : t.setData({
                    page: t.data.page - 1,
                    isLoadMore: !1
                });
            },
            fail: function(a) {
                console.log(a.msg);
            }
        }));
    },
    onShareAppMessage: function() {}
});